package cn.eoe.example.timer_and_timertask;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.Html;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.Timer;

import cn.eoe.example.timer_and_timertask.ui.login.LoadHelper;

public class MainActivity extends AppCompatActivity {

    private TextView tv;
    private ImageView iv;
    private LoadHelper myloadHelper;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv=findViewById(R.id.textView);
        iv=findViewById(R.id.imageView);
        myloadHelper=new LoadHelper(tv,iv,this);
    }


    @Override
    protected void onStart() {
        super.onStart();
        //myloadHelper.start();
        myloadHelper.start(R.drawable.loading,null);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        myloadHelper.stop();
    }

    /**
     * 2.    显示多种颜色的字
     * Android支持html格式的字符串，通过调用Html.fromHtml(str)方法可以转换html格式的字符串str。
     * tv.setText(Html.fromHtml(textStr1+textStr2+textStr3+textStr4));
     *
     *     String textStr1 = "<font color=\"#ffff00\">如果有一天，</font><br>";
     *     String textStr2 = "<font color=\"#00ff00\">我厌倦了这里，</font><br>";
     *     String textStr3 = "<font color=\"#ff00ff\">我会乘着梦，</font><br>";
     *     String textStr4 = "<font color=\"#00ffff\">飞向那个属于自己的<br>世界……</font><br>";
     *
     *     tv1.setText(Html.fromHtml(textStr1+textStr2+textStr3+textStr4));
     */
}